﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMS.Data.Classes;

namespace CMS.Data.Repositorios
{
    public class StatusRepository
    {
        ImobiliariaDataContext Context = new ImobiliariaDataContext();

        public void Save(Status imov)
        {
            if (imov.Status_ID == 0)
                Context.Status.InsertOnSubmit(imov);

            Context.SubmitChanges();
        }

        public void Delete(Status imov)
        {
            Context.Status.DeleteOnSubmit(imov);
            Context.SubmitChanges();
        }

        public IEnumerable<Status> SelectAll()
        {
            return Context.Status;
        }

        public Status SelectById(int Id)
        {
            return Context.Status.Where(x => x.Status_ID == Id).FirstOrDefault();
        }

    }

}
